<!-- param form content -->
<style>
    .smart-timeline-list li {
        padding: 5px 0;
    }
</style>
<div class="well dialog-well">

    <div class="widget-body no-padding">

        <form id="param-form" action="${ctx}/tools/console/save" method="post" class="smart-form">

            <fieldset>
                <div class="hide">
                    <input type="hidden" name="id"> 　
                </div>

                <div class="row">
                    <section class="col col-6">
                        <label class="label">名称</label>
                        <label class="input state-disabled">
                            <i class="icon-append fa fa-book"></i>
                            <input type="text" name="name" placeholder="显示名称">
                            <b class="tooltip tooltip-bottom-right">配置的显示名称,必须设置</b>
                        </label>
                    </section>
                    <section class="col col-6">
                        <label class="label">协议类型</label>
                        <label class="select" rel="tooltip" data-placement="bottom"
                               data-original-title='配置的协议类型选择,编辑状态时不可更改'>
                            <select name="protocol">
                                <option value="ssh">SSH 协议</option>
                                <option value="telnet">TELNET 协议</option>
                                <option value="vnc">VNC 协议</option>
                                <option value="rdp">RDP 协议</option>
                            </select><i></i>
                        </label>
                    </section>
                </div>
            </fieldset>
            <fieldset>
                <div id="dynamic-layout">

                </div>
            </fieldset>
            <footer>
                <button type="submit" class="btn btn-primary">
                    <i class="fa fa-save"></i>
                    确定
                </button>
                <button type="button" class="btn btn-default" onclick="pageRedirct();">
                    <i class="fa fa-reply"></i>
                    取消
                </button>
            </footer>
        </form>

        <!-- 各种类型的配置项, 用于动态切换 -->
        <div class="hidden">

            <!-- SSH Content -->
            <div class="smart-timeline ssh-type">
                <ul class="smart-timeline-list">
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-server"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>主机配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <div class="row padding-top-10">
                                <section class="col col-6">
                                    <label class="label">主机地址</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-location-arrow"></i>
                                        <input type="text" name="hostname" placeholder="127.0.0.1">
                                        <b class="tooltip tooltip-top-right">SSH的连接地址,必须设置</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">端口</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-openid"></i>
                                        <input type="text" name="port" placeholder="22">
                                        <b class="tooltip tooltip-top-right">SSH的连接端口,默认是 <code>22</code></b>
                                    </label>
                                </section>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-lock"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>认证配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <div class="row padding-top-10">
                                <section class="col col-6">
                                    <label class="label">用户名</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-user"></i>
                                        <input type="text" name="username" placeholder="root">
                                        <b class="tooltip tooltip-top-right">主机的登录用户名</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">密码</label>
                                    <label class="input">
                                        <input type="password" name="password"
                                               placeholder="">
                                        <b class="tooltip tooltip-top-right">主机的登录密码</b>
                                    </label>
                                </section>
                            </div>
                            <section>
                                <label class="label">私钥</label>
                                <label class="textarea">
                                    <i class="icon-append fa fa-key"></i>
                                    <textarea rows="4" name="private_key"></textarea>
                                    <b class="tooltip tooltip-top-right">主机的私钥信息,可以不用密码认证,通过私钥登录</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">认证</label>
                                <label class="input">
                                    <input type="password" name="passphrase" placeholder="">
                                    <b class="tooltip tooltip-top-right">私钥的密码,如果私钥无密码,可以不填写</b>
                                </label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-desktop"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>显示配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="label">颜色选项</label>
                                <label class="select" rel="tooltip" data-placement="bottom"
                                       data-original-title='控制台的颜色方案'>
                                    <select name="color_scheme">
                                        <option value="gray-black">灰/黑色</option>
                                        <option value="black-white">黑/白色</option>
                                        <option value="green-black">绿/黑色</option>
                                        <option value="white-black">白/黑色</option>
                                    </select><i></i>
                                </label>
                            </section>
                            <div class="row">
                                <section class="col col-6">
                                    <label class="label">字体名称</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-font"></i>
                                        <input type="text" name="font_name" placeholder="">
                                        <b class="tooltip tooltip-bottom-right">控制台显示的字体名称.默认 <code>monospace</code></b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">字体大小</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-sort-numeric-desc"></i>
                                        <input type="text" name="font_size" value="12">
                                        <b class="tooltip tooltip-bottom-right">控制台显示的字体大小,默认 <code>12</code></b>
                                    </label>
                                </section>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-terminal"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>命令配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="label">命令</label>
                                <label class="input">
                                    <i class="icon-append fa fa-arrow-circle-right"></i>
                                    <input type="text" name="command" placeholder="">
                                    <b class="tooltip tooltip-bottom-right">登录成功后执行的命令,例如 <code>cd /</code></b>
                                </label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-file-text-o"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>传输配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="checkbox"><input type="checkbox" name="enable_sftp" value="true">
                                    <i></i>启用SFTP</label>
                            </section>
                        </div>
                    </li>
                </ul>
            </div>
            <!-- END SSH Content -->

            <!-- TELNET Content -->
            <div class="smart-timeline telnet-type">
                <ul class="smart-timeline-list">
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-server"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>主机配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <div class="row padding-top-10">
                                <section class="col col-6">
                                    <label class="label">主机地址</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-location-arrow"></i>
                                        <input type="text" name="hostname" placeholder="127.0.0.1">
                                        <b class="tooltip tooltip-top-right">TELNET的连接地址,必须设置</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">端口</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-openid"></i>
                                        <input type="text" name="port" placeholder="23">
                                        <b class="tooltip tooltip-top-right">TELNET的连接端口,默认是 <code>23</code></b>
                                    </label>
                                </section>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-lock"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>认证配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <div class="row padding-top-10">
                                <section class="col col-6">
                                    <label class="label">用户名</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-user"></i>
                                        <input type="text" name="username" placeholder="root">
                                        <b class="tooltip tooltip-top-right">主机的登录用户名</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">密码</label>
                                    <label class="input">
                                        <input type="password" name="password"
                                               placeholder="">
                                        <b class="tooltip tooltip-top-right">主机的登录密码</b>
                                    </label>
                                </section>
                            </div>
                            <div class="row">
                                <section class="col col-6">
                                    <label class="label">用户名提示</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-info"></i>
                                        <input type="text" name="username_regex" placeholder="">
                                        <b class="tooltip tooltip-top-right">在等待用户名提示符时使用的正则表达式,不填使用默认值</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">密码提示</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-info-circle"></i>
                                        <input type="text" name="password_regex" placeholder="">
                                        <b class="tooltip tooltip-top-right">在等待密码提示符时使用的正则表达式,不填使用默认值</b>
                                    </label>
                                </section>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-desktop"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>显示配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="label">颜色选项</label>
                                <label class="select" rel="tooltip" data-placement="bottom"
                                       data-original-title='控制台的颜色方案'>
                                    <select name="color_scheme">
                                        <option value="gray-black">灰/黑色</option>
                                        <option value="black-white">黑/白色</option>
                                        <option value="green-black">绿/黑色</option>
                                        <option value="white-black">白/黑色</option>
                                    </select><i></i>
                                </label>
                            </section>
                            <div class="row">
                                <section class="col col-6">
                                    <label class="label">字体名称</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-font"></i>
                                        <input type="text" name="font_name" placeholder="">
                                        <b class="tooltip tooltip-bottom-right">控制台显示的字体名称.默认 <code>monospace</code></b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">字体大小</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-sort-numeric-desc"></i>
                                        <input type="text" name="font_size" value="12">
                                        <b class="tooltip tooltip-bottom-right">控制台显示的字体大小,默认 <code>12</code> </b>
                                    </label>
                                </section>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
            <!-- END TELNET Content -->

            <!-- VNC Content -->
            <div class="smart-timeline vnc-type">
                <ul class="smart-timeline-list">
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-server"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>主机配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <div class="row padding-top-10">
                                <section class="col col-6">
                                    <label class="label">主机地址</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-location-arrow"></i>
                                        <input type="text" name="hostname" placeholder="127.0.0.1">
                                        <b class="tooltip tooltip-top-right">VNC的连接地址,必须设置</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">端口</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-openid"></i>
                                        <input type="text" name="port" value="5900" placeholder="5900">
                                        <b class="tooltip tooltip-top-right">VNC的连接端口,默认是 <code>5900</code></b>
                                    </label>
                                </section>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-lock"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>认证配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="label">密码</label>
                                <label class="input">
                                    <input type="password" name="password"
                                           placeholder="">
                                    <b class="tooltip tooltip-top-right">主机的登录密码</b>
                                </label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-desktop"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>显示配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="checkbox"><input type="checkbox" name="color_depth" value="true">
                                    <i></i>只读</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="swap_red_blue" value="true">
                                    <i></i>红蓝颜色互换</label>
                            </section>
                            <section>
                                <label class="label">光标</label>
                                <label class="select" rel="tooltip" data-placement="bottom"
                                       data-original-title='光标的显示效果'>
                                    <select name="cursor">
                                        <option value="local">本地</option>
                                        <option value="remote">远程</option>
                                    </select><i></i>
                                </label>
                            </section>
                            <section>
                                <label class="label">颜色深度</label>
                                <label class="select" rel="tooltip" data-placement="bottom"
                                       data-original-title='控制台的颜色深度'>
                                    <select name="color_depth">
                                        <option value="16">低色(16位)</option>
                                        <option value="24">真色(24位)</option>
                                        <option value="32">真色(32位)</option>
                                        <option value="256" selected>256色</option>
                                    </select><i></i>
                                </label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-repeat"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>VNC代理</small>
                        </div>
                        <div class="smart-timeline-content">
                            <div class="row padding-top-10">
                                <section class="col col-6">
                                    <label class="label">目的主机</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-location-arrow"></i>
                                        <input type="text" name="dest_host" placeholder="">
                                        <b class="tooltip tooltip-top-right">重定向的主机的地址,默认为空</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">目的端口</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-openid"></i>
                                        <input type="text" name="dest_port" placeholder="">
                                        <b class="tooltip tooltip-top-right">重定向的主机的连接端口,默认为空</b>
                                    </label>
                                </section>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-clipboard"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>剪切板配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="label">编码</label>
                                <label class="select" rel="tooltip" data-placement="bottom"
                                       data-original-title='剪切板的编码,默认<code>ISO-8859-1</code>'>
                                    <select name="clipboard_encoding">
                                        <option value="ISO8859-1">ISO8859-1</option>
                                        <option value="UTF-8">UTF-8</option>
                                        <option value="UTF-16">UTF-16</option>
                                        <option value="CP1252">CP1252</option>
                                    </select><i></i>
                                </label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-file-text-o"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>传输配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="checkbox"><input type="checkbox" name="enable_sftp" value="true">
                                    <i></i>启用SFTP</label>
                            </section>
                            <div class="row">
                                <section class="col col-6">
                                    <label class="label">主机名</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-location-arrow"></i>
                                        <input type="text" name="sftp_hostname" placeholder="127.0.0.1">
                                        <b class="tooltip tooltip-top-right">SFTP的连接地址,启用SFTP时必须设置</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">端口</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-openid"></i>
                                        <input type="text" name="sftp_port" placeholder="22">
                                        <b class="tooltip tooltip-top-right">SFTP的连接端口,默认是 <code>22</code></b>
                                    </label>
                                </section>
                            </div>
                            <div class="row">
                                <section class="col col-6">
                                    <label class="label">用户名</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-user"></i>
                                        <input type="text" name="sftp_username" placeholder="root">
                                        <b class="tooltip tooltip-top-right">主机的SFTP用户名</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">密码</label>
                                    <label class="input">
                                        <input type="password" name="sftp_password"
                                               placeholder="">
                                        <b class="tooltip tooltip-top-right">SFTP的登录密码</b>
                                    </label>
                                </section>
                            </div>
                            <section>
                                <label class="label">私钥</label>
                                <label class="textarea">
                                    <i class="icon-append fa fa-key"></i>
                                    <textarea rows="4" name="sftp_private_key"></textarea>
                                    <b class="tooltip tooltip-top-right">SFTP的私钥信息,可以不用密码认证,通过私钥登录</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">认证</label>
                                <label class="input">
                                    <input type="password" name="sftp_passphrase" placeholder="">
                                    <b class="tooltip tooltip-top-right">私钥的密码,如果私钥无密码,可以不填写</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">默认上传目录</label>
                                <label class="input">
                                    <i class="icon-append fa fa-file-o"></i>
                                    <input type="text" name="sftp_directory" placeholder="">
                                    <b class="tooltip tooltip-bottom-right">默认文件上传目录,不填写使用SSH服务提供的</b>
                                </label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-volume-up"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>音频配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="checkbox"><input type="checkbox" name="enable_audio" value="true">
                                    <i></i>启用音频</label>
                            </section>
                            <section>
                                <label class="label">音频服务器</label>
                                <label class="input">
                                    <i class="icon-append fa fa-server"></i>
                                    <input type="text" name="audio_servername" placeholder="">
                                    <b class="tooltip tooltip-bottom-right">音频服务器的连接地址</b>
                                </label>
                            </section>
                        </div>
                    </li>
                </ul>
            </div>
            <!-- END VNC Content -->

            <!-- RDP Content -->
            <div class="smart-timeline rdp-type">
                <ul class="smart-timeline-list">
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-server"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>主机配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <div class="row padding-top-10">
                                <section class="col col-6">
                                    <label class="label">主机地址</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-location-arrow"></i>
                                        <input type="text" name="hostname" placeholder="127.0.0.1">
                                        <b class="tooltip tooltip-top-right">RDP的连接地址,必须设置</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">端口</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-openid"></i>
                                        <input type="text" name="port" value="3389" placeholder="3389">
                                        <b class="tooltip tooltip-top-right">RDP的连接端口,默认是 <code>3389</code></b>
                                    </label>
                                </section>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-lock"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>认证配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <div class="row padding-top-10">
                                <section class="col col-6">
                                    <label class="label">用户名</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-user"></i>
                                        <input type="text" name="username" placeholder="root">
                                        <b class="tooltip tooltip-top-right">主机的登录用户名</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">密码</label>
                                    <label class="input">
                                        <input type="password" name="password"
                                               placeholder="">
                                        <b class="tooltip tooltip-top-right">主机的登录密码</b>
                                    </label>
                                </section>
                            </div>
                            <section>
                                <label class="label">域</label>
                                <label class="input">
                                    <i class="icon-append fa fa-lemon-o"></i>
                                    <input type="text" name="domain" placeholder="">
                                    <b class="tooltip tooltip-top-right">尝试身份验证时使用的域,默认为空</b>
                                </label>
                            </section>

                            <section>
                                <label class="label">安全模式</label>
                                <label class="select" rel="tooltip" data-placement="bottom"
                                       data-original-title='RDP数据交互时的加密方式'>
                                    <select name="security">
                                        <option value="any">任何</option>
                                        <option value="nla">NLA(网络级认证)</option>
                                        <option value="rdp" selected>RDP加密</option>
                                        <option value="tls">TLS加密</option>
                                    </select><i></i>
                                </label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="disable_auth" value="true">
                                    <i></i>禁用认证</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="ignore_cert" value="true">
                                    <i></i>忽略服务器证书</label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-play"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>启动配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="label">初始程序</label>
                                <label class="input">
                                    <i class="icon-append fa fa-adn"></i>
                                    <input type="text" name="initial_program" placeholder="">
                                    <b class="tooltip tooltip-top-right">连接时立即运行的程序的完整路径,默认为空</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">客户端名称</label>
                                <label class="input">
                                    <i class="icon-append fa fa-tags"></i>
                                    <input type="text" name="client_name" placeholder="">
                                    <b class="tooltip tooltip-top-right">默认使用hostname,可以自己设置</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">键盘布局</label>
                                <label class="select" rel="tooltip" data-placement="bottom"
                                       data-original-title='服务器的键盘布局'>
                                    <select name="server_layout">
                                        <option value="en-us-qwerty" selected>英语布局</option>
                                        <option value="de-de-qwerty">德语布局</option>
                                        <option value="fr-fr-qwerty">法语布局</option>
                                        <option value="it-it-qwerty">爱尔兰语布局</option>
                                        <option value="ja-jp-qwerty">日语布局</option>
                                        <option value="sv-se-qwerty">瑞典语布局</option>
                                        <option value="failsafe">无法识别</option>
                                    </select><i></i>
                                </label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="console" value="true">
                                    <i></i>启用管理员控制台</label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-desktop"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>显示配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <div class="row padding-top-10">
                                <section class="col col-6">
                                    <label class="label">宽度</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-arrows-h"></i>
                                        <input type="text" name="width" placeholder="">
                                        <b class="tooltip tooltip-top-right">客户端显示的屏幕宽度(像素),默认为空</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">高度</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-arrows-v"></i>
                                        <input type="text" name="height" placeholder="">
                                        <b class="tooltip tooltip-top-right">客户端显示的屏幕高度(像素),默认为空</b>
                                    </label>
                                </section>
                            </div>
                            <section>
                                <label class="label">分辨率(DPI)</label>
                                <label class="input">
                                    <i class="icon-append fa fa-laptop"></i>
                                    <input type="text" name="dpi" placeholder="">
                                    <b class="tooltip tooltip-top-right">客户端显示所需的有效分辨率,默认为空</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">颜色深度</label>
                                <label class="select" rel="tooltip" data-placement="bottom"
                                       data-original-title='页面的颜色深度'>
                                    <select name="color_depth">
                                        <option value="16">低色(16位)</option>
                                        <option value="24">真色(24位)</option>
                                        <option value="32">真色(32位)</option>
                                        <option value="256" selected>256色</option>
                                    </select><i></i>
                                </label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-windows"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>性能</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="checkbox"><input type="checkbox" name="enable_wallpaper" value="true">
                                    <i></i>启用壁纸</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="enable_theming" value="true">
                                    <i></i>启用主题</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="enable_font_smoothing"
                                                               value="true">
                                    <i></i>启用字体平滑(ClearType)</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="enable_full_window_drag"
                                                               value="true">
                                    <i></i>启用窗口拖拽</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="enable_desktop_composition"
                                                               value="true">
                                    <i></i>启用桌面组合(Aero)</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="enable_menu_animations"
                                                               value="true">
                                    <i></i>启用菜单动画</label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-usb"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>重定向配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="checkbox"><input type="checkbox" name="console_audio" value="true">
                                    <i></i>控制台支持音频</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="disable_audio" value="true">
                                    <i></i>禁用音频</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="enable_printing" value="true">
                                    <i></i>启用打印</label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="enable_drive" value="true">
                                    <i></i>启用驱动</label>
                            </section>
                            <section>
                                <label class="label">驱动路径</label>
                                <label class="input">
                                    <i class="icon-append fa fa-file-text-o"></i>
                                    <input type="text" name="drive_path" placeholder="">
                                    <b class="tooltip tooltip-top-right">启用传输后的驱动路径</b>
                                </label>
                            </section>
                            <section>
                                <label class="checkbox"><input type="checkbox" name="create_drive_path" value="true">
                                    <i></i>自动创建驱动器</label>
                            </section>
                            <section>
                                <label class="label">静态通道名称</label>
                                <label class="input">
                                    <i class="icon-append fa fa-tags"></i>
                                    <input type="text" name="static_channels" placeholder="">
                                    <b class="tooltip tooltip-top-right">远程桌面程序和浏览器页面通信通道,最大7个字符</b>
                                </label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-adn"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>远程应用</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="label">程序</label>
                                <label class="input">
                                    <i class="icon-append fa fa-weixin"></i>
                                    <input type="text" name="remote_app" placeholder="">
                                    <b class="tooltip tooltip-top-right">指定启动远程桌面时运行的程序</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">工作目录</label>
                                <label class="input">
                                    <i class="icon-append fa fa-files-o"></i>
                                    <input type="text" name="remote_app_dir" placeholder="">
                                    <b class="tooltip tooltip-top-right">程序运行的工作目录</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">参数</label>
                                <label class="input">
                                    <i class="icon-append fa fa-chain"></i>
                                    <input type="text" name="remote_app_args" placeholder="">
                                    <b class="tooltip tooltip-top-right">程序运行时的参数</b>
                                </label>
                            </section>
                        </div>
                    </li>
                    <li>
                        <div class="smart-timeline-icon">
                            <i class="fa fa-file-text-o"></i>
                        </div>
                        <div class="smart-timeline-time">
                            <small>传输配置</small>
                        </div>
                        <div class="smart-timeline-content">
                            <section class="padding-top-10">
                                <label class="checkbox"><input type="checkbox" name="enable_sftp" value="true">
                                    <i></i>启用SFTP</label>
                            </section>
                            <div class="row">
                                <section class="col col-6">
                                    <label class="label">主机名</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-location-arrow"></i>
                                        <input type="text" name="sftp_hostname" placeholder="127.0.0.1">
                                        <b class="tooltip tooltip-top-right">SFTP的连接地址,启用SFTP时必须设置</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">端口</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-openid"></i>
                                        <input type="text" name="sftp_port" placeholder="22">
                                        <b class="tooltip tooltip-top-right">SFTP的连接端口,默认是 <code>22</code></b>
                                    </label>
                                </section>
                            </div>
                            <div class="row">
                                <section class="col col-6">
                                    <label class="label">用户名</label>
                                    <label class="input">
                                        <i class="icon-append fa fa-user"></i>
                                        <input type="text" name="sftp_username" placeholder="root">
                                        <b class="tooltip tooltip-top-right">主机的SFTP用户名</b>
                                    </label>
                                </section>
                                <section class="col col-6">
                                    <label class="label">密码</label>
                                    <label class="input">
                                        <input type="password" name="sftp_password"
                                               placeholder="">
                                        <b class="tooltip tooltip-top-right">SFTP的登录密码</b>
                                    </label>
                                </section>
                            </div>
                            <section>
                                <label class="label">私钥</label>
                                <label class="textarea">
                                    <i class="icon-append fa fa-key"></i>
                                    <textarea rows="4" name="sftp_private_key"></textarea>
                                    <b class="tooltip tooltip-top-right">SFTP的私钥信息,可以不用密码认证,通过私钥登录</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">认证</label>
                                <label class="input">
                                    <input type="password" name="sftp_passphrase" placeholder="">
                                    <b class="tooltip tooltip-top-right">私钥的密码,如果私钥无密码,可以不填写</b>
                                </label>
                            </section>
                            <section>
                                <label class="label">默认上传目录</label>
                                <label class="input">
                                    <i class="icon-append fa fa-file-o"></i>
                                    <input type="text" name="sftp_directory" placeholder="">
                                    <b class="tooltip tooltip-bottom-right">默认文件上传目录,不填写使用SSH服务提供的</b>
                                </label>
                            </section>
                        </div>
                    </li>
                </ul>
            </div>
            <!-- END RDP Content -->

        </div>

    </div>
</div>
<!-- end param form content -->

<script type="text/javascript">

    /* DO NOT REMOVE : GLOBAL FUNCTIONS!
     *
     * pageSetUp(); WILL CALL THE FOLLOWING FUNCTIONS
     *
     * // activate tooltips
     * $("[rel=tooltip]").tooltip();
     *
     * // activate popovers
     * $("[rel=popover]").popover();
     *
     * // activate popovers with hover states
     * $("[rel=popover-hover]").popover({ trigger: "hover" });
     *
     * // activate inline charts
     * runAllCharts();
     *
     * // setup widgets
     * setup_widgets_desktop();
     *
     * // run form elements
     * runAllForms();
     *
     ********************************
     *
     * pageSetUp() is needed whenever you load a page.
     * It initializes and checks for all basic elements of the page
     * and makes rendering easier.
     *
     */
    pageSetUp();

    /*
     * ALL PAGE RELATED SCRIPTS CAN GO BELOW HERE
     */
    // PAGE RELATED SCRIPTS
    // pagefunction
    var pagefunction = function () {

        var $paramForm = $("#param-form");
        var $dynamicLayout = $('#dynamic-layout');

        // 设置初始化显示值
        var type = "${type}";
        var $protocol = $paramForm.find('select[name=protocol]');
        // 绑定切换事件
        $protocol.on('change', function () {
            $dynamicLayout.empty();
            $dynamicLayout.append($('.' + $(this).val() + '-type').clone());
            // 密码回显
            password_feedback($paramForm);
            initForm();
            $paramForm.find('input[name=enable_sftp]').on('click', function () {
                // 设置SFTP传输的可用状态
                if ($(this).prop('checked') == true || $(this).prop('checked') == "checked") {
                    $paramForm.find('textarea[name^="sftp_"]').removeAttr("disabled").parent().removeClass("state-disabled");
                    $paramForm.find('input[name^="sftp_"]').removeAttr("disabled").parent().removeClass("state-disabled");
                } else {
                    $paramForm.find('textarea[name^="sftp_"]').attr("disabled", "disabled").parent().addClass("state-disabled");
                    $paramForm.find('input[name^="sftp_"]').attr("disabled", "disabled").parent().addClass("state-disabled");
                }
            });
        });
        // 新建时可以切换类型
        if (type == "new" || type == "" || type == "all" || type == undefined) {
            $protocol.val('ssh');
        } else {
            $protocol.val(type);
            $protocol.attr("disabled", "disabled");
            $protocol.parent().addClass("state-disabled");
        }
        // 设置初始化显示值
        $protocol.trigger('change');

        $paramForm.validate({
            // Rules for form validation
            rules: {
                // 为了不污染html代码,验证统一在js中
                name: {
                    required: true,
                    maxlength: 50
                },
                hostname: {
                    required: true,
                    maxlength: 100
                },
                port: {
                    required: true,
                    digits: true,
                    min: 1,
                    max: 65535
                },
                username: {
                    required: true,
                    maxlength: 50
                },
                password: {
                    required: true,
                    maxlength: 50
                },
                font_name: {
                    maxlength: 128
                },
                font_size: {
                    required: true,
                    digits: true,
                    min: 4,
                    max: 200
                },
                dest_host: {
                    maxlength: 100
                },
                dest_port: {
                    digits: true,
                    min: 1,
                    max: 65535
                },
                domain: {
                    maxlength: 200
                },
                dpi: {
                    maxlength: 20
                },
                width: {
                    maxlength: 50
                },
                height: {
                    maxlength: 50
                }
            },

            // Messages for form validation,use default
            messages: {
                // 不覆盖使用默认js多语言文件
            },
            submitHandler: function (form) {
                // 遮罩
                var loadIndex = parent.layer.load(0, {shade: 0.4});

                var formData = {};
                var t = $(form).serializeArray();
                $.each(t, function () {
                    formData[this.name] = this.value;
                });

                $(form).ajaxSubmit({
                    dataType: "json",
                    data: {type: $protocol.val(), data: JSON.stringify(formData)},
                    success: function (data) {
                        parent.layer.close(loadIndex);

                        if (data && data.status == 'success') {
                            parent.messageBox(data.message, "success");
                            pageRedirct();
                        } else {
                            parent.messageBox(data.message, "error");
                        }
                        // 显示
                        parent.layer.closeAll('page');
                    },
                    error: function () {
                        parent.layer.close(loadIndex);
                        parent.messageBox("修改参数配置错误!", "error");
                    }
                });
                // always return false to prevent standard browser submit and page navigation
                return false;
            },
            // Do not change code below
            errorPlacement: function (error, element) {
                error.insertAfter(element.parent());
            }
        });

        /**
         * 初始化form
         */
        function initForm() {
            var entity = JSON.parse('${entity}');

            // 更新时设置回填
            if (type != "new" && type != "" && type != undefined) {
                // 公共属性
                $paramForm.find('input[name=id]').val(entity['id']);
                $paramForm.find('input[name=name]').val(entity['name']);

                // ssh属性
                // 主机地址  hostname
                $paramForm.find('input[name=hostname]').val(entity['hostname']);
                // 端口     port
                $paramForm.find('input[name=port]').val(entity['port']);
                // 用户名    username
                $paramForm.find('input[name=username]').val(entity['username']);
                // 密码     password
                $paramForm.find('input[name=password]').val(entity['password']);
                // 私钥     private_key
                $paramForm.find('textarea[name=private_key]').val(entity['private_key']);
                // 私钥密码  passphrase
                $paramForm.find('input[name=passphrase]').val(entity['passphrase']);
                // 颜色方案  color_scheme
                $paramForm.find('select[name=color_scheme]').val(entity['color_scheme']);
                // 字体     font_name
                $paramForm.find('input[name=font_name]').val(entity['font_name']);
                // 字体大小  font_size
                $paramForm.find('input[name=font_size]').val(entity['font_size']);
                // 命令 command
                $paramForm.find('input[name=command]').val(entity['command']);
                if (entity['enable_sftp'] == true || entity['enable_sftp'] == "true") {
                    // 开启sftp  enable_sftp
                    $paramForm.find('input[name=enable_sftp]').prop('checked', 'checked');
                }

                // telnet属性,属于ssh的子集

                // vnc属性
                // 色彩深度   color_depth
                $paramForm.find('select[name=color_depth]').val(entity['color_depth']);
                // 色彩饱和度  swap_red_blue
                if (entity['swap_red_blue'] == true || entity['swap_red_blue'] == "true") {
                    $paramForm.find('input[name=swap_red_blue]').prop('checked', 'checked');
                }
                // 鼠标       cursor
                $paramForm.find('select[name=cursor]').val(entity['cursor']);
                // 只读       read_only
                if (entity['read_only'] == true || entity['read_only'] == "true") {
                    $paramForm.find('input[name=read_only]').prop('checked', 'checked');
                }
                // sftp主机地址   sftp_hostname
                $paramForm.find('input[name=sftp_hostname]').val(entity['sftp_hostname']);
                // sftp端口      sftp_port
                $paramForm.find('input[name=sftp_port]').val(entity['sftp_port']);
                // sftp用户名     sftp_username
                $paramForm.find('input[name=sftp_username]').val(entity['sftp_username']);
                // sftp密码      sftp_password
                $paramForm.find('input[name=sftp_password]').val(entity['sftp_password']);
                // sftp私钥      sftp_private_key
                $paramForm.find('textarea[name=sftp_private_key]').val(entity['sftp_private_key']);
                // sftp私钥密码   sftp_passphrase
                $paramForm.find('input[name=sftp_passphrase]').val(entity['sftp_passphrase']);
                // sftp默认目录   sftp_directory
                $paramForm.find('input[name=sftp_directory]').val(entity['sftp_directory']);
                // 目的主机       dest_host
                $paramForm.find('input[name=dest_host]').val(entity['dest_host']);
                // 目的端口       dest_port
                $paramForm.find('input[name=dest_port]').val(entity['dest_port']);
                // 剪贴板编码     clipboard_encoding
                $paramForm.find('select[name=clipboard_encoding]').val(entity['clipboard_encoding']);
                // 启用音频      enable_audio
                if (entity['enable_audio'] == true || entity['enable_audio'] == "true") {
                    $paramForm.find('input[name=enable_audio]').prop('checked', 'checked');
                }
                // 音频服务器地址  audio_servername
                $paramForm.find('input[name=audio_servername]').val(entity['audio_servername']);

                // rdp属性
                // 域       domain
                $paramForm.find('input[name=domain]').val(entity['domain']);
                // 加密模式  security
                $paramForm.find('select[name=security]').val(entity['security']);
                // 忽略证书  ignore_cert
                if (entity['ignore_cert'] == true || entity['ignore_cert'] == "true") {
                    $paramForm.find('input[name=ignore_cert]').prop('checked', 'checked');
                }
                // 禁止认证  disable_auth
                if (entity['disable_auth'] == true || entity['disable_auth'] == "true") {
                    $paramForm.find('input[name=disable_auth]').prop('checked', 'checked');
                }

                // 客户端名称 client_name
                $paramForm.find('input[name=client_name]').val(entity['client_name']);
                // console会话 console
                if (entity['console'] == true || entity['console'] == "true") {
                    $paramForm.find('input[name=console]').prop('checked', 'checked');
                }
                // 初始化参数 initial_program
                $paramForm.find('input[name=initial_program]').val(entity['initial_program']);
                // 服务器键盘布局 server_layout
                $paramForm.find('select[name=server_layout]').val(entity['server_layout']);

                // 宽度    width
                $paramForm.find('input[name=width]').val(entity['width']);
                // 高度    height
                $paramForm.find('input[name=height]').val(entity['height']);
                // dpi     dpi
                $paramForm.find('input[name=dpi]').val(entity['dpi']);

                // 禁止音频 disable_audio
                if (entity['disable_audio'] == true || entity['disable_audio'] == "true") {
                    $paramForm.find('input[name=disable_audio]').prop('checked', 'checked');
                }
                // 允许打印  enable_printing
                if (entity['enable_printing'] == true || entity['enable_printing'] == "true") {
                    $paramForm.find('input[name=enable_printing]').prop('checked', 'checked');
                }
                // 允许驱动  enable_drive
                if (entity['enable_drive'] == true || entity['enable_drive'] == "true") {
                    $paramForm.find('input[name=enable_drive]').prop('checked', 'checked');
                }
                // 驱动地址  drive_path
                $paramForm.find('input[name=drive_path]').val(entity['drive_path']);
                // 创建驱动路径 create_drive_path
                if (entity['create_drive_path'] == true || entity['create_drive_path'] == "true") {
                    $paramForm.find('input[name=create_drive_path]').prop('checked', 'checked');
                }
                // console会话音频 console_audio
                if (entity['console_audio'] == true || entity['console_audio'] == "true") {
                    $paramForm.find('input[name=console_audio]').prop('checked', 'checked');
                }
                // 静态通道  static_channels
                $paramForm.find('input[name=static_channels]').val(entity['static_channels']);

                // 允许壁纸  enable_wallpaper
                if (entity['enable_wallpaper'] == true || entity['enable_wallpaper'] == "true") {
                    $paramForm.find('input[name=enable_wallpaper]').prop('checked', 'checked');
                }
                // 允许主题  enable_theming
                if (entity['enable_theming'] == true || entity['enable_theming'] == "true") {
                    $paramForm.find('input[name=enable_theming]').prop('checked', 'checked');
                }
                // 启用字体平滑 enable_font_smoothing
                if (entity['enable_font_smoothing'] == true || entity['enable_font_smoothing'] == "true") {
                    $paramForm.find('input[name=enable_font_smoothing]').prop('checked', 'checked');
                }
                // 启用全屏拖拽 enable_full_window_drag
                if (entity['enable_full_window_drag'] == true || entity['enable_full_window_drag'] == "true") {
                    $paramForm.find('input[name=enable_full_window_drag]').prop('checked', 'checked');
                }
                // 启用桌面组合 enable_desktop_composition
                if (entity['enable_desktop_composition'] == true || entity['enable_desktop_composition'] == "true") {
                    $paramForm.find('input[name=enable_desktop_composition]').prop('checked', 'checked');
                }
                // 启用菜单动画 enable_menu_animations
                if (entity['enable_menu_animations'] == true || entity['enable_menu_animations'] == "true") {
                    $paramForm.find('input[name=enable_menu_animations]').prop('checked', 'checked');
                }

                // 远程应用程序 remote_app
                $paramForm.find('input[name=remote_app]').val(entity['remote_app']);
                // 远程应用程序地址 remote_app_dir
                $paramForm.find('input[name=remote_app_dir]').val(entity['remote_app_dir']);
                // 远程应用程序参数 remote_app_args
                $paramForm.find('input[name=remote_app_args]').val(entity['remote_app_args']);
            }
            // 设置SFTP传输的可用状态
            if ($paramForm.find('input[name=enable_sftp]').prop('checked') == false
                    || $paramForm.find('input[name=enable_sftp]').prop('checked') == "false") {
                $paramForm.find('input[name^="sftp_"]').attr("disabled", "disabled").parent().addClass("state-disabled");
                $paramForm.find('textarea[name^="sftp_"]').attr("disabled", "disabled").parent().addClass("state-disabled");
            } else {
                $paramForm.find('input[name^="sftp_"]').removeAttr("disabled").parent().removeClass("state-disabled");
                $paramForm.find('textarea[name^="sftp_"]').removeAttr("disabled").parent().removeClass("state-disabled");
            }
        }

        /**
         * 保存和取消之后页面到列表
         */
        function pageRedirct() {
            var treeObj = $.fn.zTree.getZTreeObj("paramTree");

            var node = treeObj.getNodeByParam("id", $paramForm.find('select[name="protocol"]').val());
            if (node) {
                treeObj.reAsyncChildNodes(node, "refresh");
                treeObj.selectNode(node);
                $("#" + node.tId + "_a").click();
            }
        }

        // 注册
        window.pageRedirct = pageRedirct;
    };

    // destroy generated instances
    // pagedestroy is called automatically before loading a new page
    // only usable in AJAX version!
    var pagedestroy = function () {
        window.pageRedirct = undefined;
    };
    // end destroy

    // load related plugins
    loadScript("/static/js/plugin/jquery-form/jquery.form.js", pagefunction);

</script>